import os
import time


def timestamp_to_chinese_time(timestamp):
    vtime = time.localtime(timestamp)
    print('vtime', vtime)
    vdatetime = time.strftime('%Y-%m-%d %H:%M:%S', vtime)
    return vdatetime


def size_to_M(size):
    vsize = size / 1024
    return vsize


if __name__ == '__main__':
    file_info = os.stat('../Chapter1/test.txt')
    print(file_info)
    print('创建时间：', timestamp_to_chinese_time(file_info.st_ctime))
    print('文件大小：', size_to_M(file_info.st_size), 'M')
